package com.sky.dubbo.nacos.demo.consumer;
import com.sky.dubbo.nacos.demo.service.DemoService;
import org.apache.dubbo.config.annotation.Reference;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

import javax.annotation.PostConstruct;
import java.io.IOException;
@SpringBootApplication
public class ConsumerApplication {
  @Value(value = "${demo.service.name}")
  private String useLocalCache;
  @Reference(version = "${demo.service.version}")
  private DemoService demoService;
  public static void main(String[] args) throws IOException {
    new SpringApplication(ConsumerApplication.class).run(args);
  }
  @PostConstruct
  public void init() {
    for (int i = 0; i < 10; i++) {
      System.out.println(demoService.sayName(useLocalCache));
    }
  }
}
